﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TexasHoldem.RankedHands
{
    public class PokerHand: RankedHand
    {
        private PokerHand(Hand hand) : base(hand) { }
        public static PokerHand TryCreateFrom(Hand hand)
        {
            return hand.Cards.GroupBy(c => c.Value).Any(g => g.Count() >= 4) ? new PokerHand(hand) : null;
        }

        public override string RankName
        {
            get { return "Four of a Kind"; }
        }

        protected override ushort RankingStrength
        {
            get { return 7; }
        }

        protected override IEnumerable<Card> FindDefiningCards()
        {
            return Cards.GroupBy(c => c.Value).First(g => g.Count() >= 4);
        }
    }
}
